package com.tdk.wifidirectserver.ui.chat

import android.os.Bundle
import android.view.LayoutInflater
import android.view.View
import android.view.ViewGroup
import androidx.fragment.app.Fragment
import com.tdk.wifidirectserver.databinding.FragmentFileTransferBinding
import com.tdk.wifidirectserver.ui.main.ConnectedServerViewModel


class FileTransferFragment : Fragment() {

    lateinit var binding: FragmentFileTransferBinding
    var connectedServerViewModel: ConnectedServerViewModel? = null


    override fun onCreate(savedInstanceState: Bundle?) {
        super.onCreate(savedInstanceState)

    }

    override fun onCreateView(
        inflater: LayoutInflater, container: ViewGroup?,
        savedInstanceState: Bundle?
    ): View {
        binding = FragmentFileTransferBinding.inflate(inflater, container, false)
        binding.btSendFile.setOnClickListener {
            connectedServerViewModel?.sendFile()
        }

        return binding.root
    }

    companion object {
        @JvmStatic
        fun newInstance(viewModel: ConnectedServerViewModel) =
            FileTransferFragment().apply {
                connectedServerViewModel = viewModel
            }
    }
}